<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta content="This is Chris's Home Page" name="description">
    <meta content="Chris,Web,Music,photo" name="keywords">
    <meta content="text/html;charset=utf-8" http-equiv="content-type"/>
    <title>Hello JavaScript!</title>
    <script type="text/javascript">
        function stu(name, age, sex) {
            this.name = name;
            this.age = age;
            this.sex = sex;
            this.toString = function () {
                return "name:" + this.name + "," + "age:" + this.age;
            }
        }

        var stu1 = new stu("zhangsan", 18, true);
        var stu2 = new stu("lisi", 28, false);
        var stu3 = new stu("wangwu", 15, false);

        var arr = [stu1, stu2, stu3];

        arr.sort(function (a, b) {
            if (a.name < b.name) {
                return 1;
            } else if (a.name == b.name) {
                return 0;
            } else {
                return -1;
            }
        });

        alert(arr.join("\n"));
    </script>
</head>
<body>
<br/>
<br/>
<br/>
<br/>
<button>Click me</button>
</body>
</html>
